package com.yaoyou.dao;

import com.yaoyou.model.dataObject.News;
import com.yaoyou.model.dataObject.NewsExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface NewsMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table NEWS
     *
     * @mbggenerated Sat Aug 27 12:15:28 CST 2016
     */
    @SelectProvider(type=NewsSqlProvider.class, method="countByExample")
    int countByExample(NewsExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table NEWS
     *
     * @mbggenerated Sat Aug 27 12:15:28 CST 2016
     */
    @DeleteProvider(type=NewsSqlProvider.class, method="deleteByExample")
    int deleteByExample(NewsExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table NEWS
     *
     * @mbggenerated Sat Aug 27 12:15:28 CST 2016
     */
    @Delete({
        "delete from NEWS",
        "where NEWS_ID = #{newsId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer newsId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table NEWS
     *
     * @mbggenerated Sat Aug 27 12:15:28 CST 2016
     */
    @Insert({
        "insert into NEWS (NEWS_ID, TITLE, ",
        "BODY, IMG_URL, URL, ",
        "CREATE_TIME)",
        "values (#{newsId,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, ",
        "#{body,jdbcType=VARCHAR}, #{imgUrl,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, ",
        "#{createTime,jdbcType=TIMESTAMP})"
    })
    int insert(News record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table NEWS
     *
     * @mbggenerated Sat Aug 27 12:15:28 CST 2016
     */
    @InsertProvider(type=NewsSqlProvider.class, method="insertSelective")
    int insertSelective(News record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table NEWS
     *
     * @mbggenerated Sat Aug 27 12:15:28 CST 2016
     */
    @SelectProvider(type=NewsSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="NEWS_ID", property="newsId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="TITLE", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="BODY", property="body", jdbcType=JdbcType.VARCHAR),
        @Result(column="IMG_URL", property="imgUrl", jdbcType=JdbcType.VARCHAR),
        @Result(column="URL", property="url", jdbcType=JdbcType.VARCHAR),
        @Result(column="CREATE_TIME", property="createTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<News> selectByExample(NewsExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table NEWS
     *
     * @mbggenerated Sat Aug 27 12:15:28 CST 2016
     */
    @Select({
        "select",
        "NEWS_ID, TITLE, BODY, IMG_URL, URL, CREATE_TIME",
        "from NEWS",
        "where NEWS_ID = #{newsId,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="NEWS_ID", property="newsId", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="TITLE", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="BODY", property="body", jdbcType=JdbcType.VARCHAR),
        @Result(column="IMG_URL", property="imgUrl", jdbcType=JdbcType.VARCHAR),
        @Result(column="URL", property="url", jdbcType=JdbcType.VARCHAR),
        @Result(column="CREATE_TIME", property="createTime", jdbcType=JdbcType.TIMESTAMP)
    })
    News selectByPrimaryKey(Integer newsId);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table NEWS
     *
     * @mbggenerated Sat Aug 27 12:15:28 CST 2016
     */
    @UpdateProvider(type=NewsSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") News record, @Param("example") NewsExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table NEWS
     *
     * @mbggenerated Sat Aug 27 12:15:28 CST 2016
     */
    @UpdateProvider(type=NewsSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") News record, @Param("example") NewsExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table NEWS
     *
     * @mbggenerated Sat Aug 27 12:15:28 CST 2016
     */
    @UpdateProvider(type=NewsSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(News record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table NEWS
     *
     * @mbggenerated Sat Aug 27 12:15:28 CST 2016
     */
    @Update({
        "update NEWS",
        "set TITLE = #{title,jdbcType=VARCHAR},",
          "BODY = #{body,jdbcType=VARCHAR},",
          "IMG_URL = #{imgUrl,jdbcType=VARCHAR},",
          "URL = #{url,jdbcType=VARCHAR},",
          "CREATE_TIME = #{createTime,jdbcType=TIMESTAMP}",
        "where NEWS_ID = #{newsId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(News record);
}